package org.rcloud.io.Utils;

import java.util.List;

public class PageVo<T> {

    private int count;//总数据
    private int currpage;//当前页码
    private int size;//每页显示的数量
    private List<T> info;
    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getCurrpage() {
        return currpage;
    }

    public void setCurrpage(int currpage) {
        this.currpage = currpage;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public List<T> getInfo() {
        return info;
    }

    public void setInfo(List<T> info) {
        this.info = info;
    }

    public static <T> PageVo<T> setOk(List<T> list){
        PageVo<T> pageVo = new PageVo<>();

        pageVo.setCode(0);
        pageVo.setMsg("ok");
        pageVo.setInfo(list);

        return pageVo;
    }

    public static <T> PageVo<T> setError(Object object){
        PageVo<T> pageVo = new PageVo<>();

        pageVo.setCode(1);
        pageVo.setMsg(object.toString());

        return pageVo;
    }



}
